<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function jiexi(){
			 let website=document.getElementById("t1").value;
			 let t=website.indexOf("?")
			 let r=website.substring(t+1);
			let array=r.split("&")
			console.log(array);
			let obj={};
			// for(a in array){
			// 	let arrT=a.split("=");
			// 	obj[arrT[0]]=decodeURI(arrT[1]);
			// }
			for(let i=0;i<array.length;i++){
				let arrT=array[i].split("=");
				obj[arrT[0]]=decodeURI(arrT[1]);
			}
			console.log(obj);
			document.getElementById("t2").value=obj;
			 
			}
		</script>
	</head>
	<body>
		输入网址: 
		<br>
		<textarea id="t1" rows="10" cols="20"></textarea>
		<br>
		<button id="b1" onclick="jiexi()">解析</button>
		<br>
		<textarea id="t2" rows="10" cols="22">
			
		</textarea>
	</body>
</html>
